package com.wondertek.poms.dao.repo;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.wondertek.poms.dao.po.SellingPriceTag;

/**
 * <p><b>IPcProductRuleDao Description:</b> 二级产品规则 Dao 执行二级产品规则 的查询、修改、新增、删除操作</p>
 * <p>@author 窦再兴</p>
 * <p><b>DATE</b> 2020-10-16 15:56:15</p>
 */
public interface ISellingPriceTagDao extends JpaRepository<SellingPriceTag, Long>, JpaSpecificationExecutor<SellingPriceTag> {

	@Query(value = "select * from SELLING_PRICE_TAG t where t.PRD_INFO_ID = ?1 and MAM_RECOMMEND is null", nativeQuery = true)
	List<SellingPriceTag> findDefaultPrice(Long prdInfoId);

	@Query(value = "select count(*) from SELLING_PRICE_TAG t where t.PRD_INFO_ID = ?1 and MAM_RECOMMEND is null", nativeQuery = true)
	int checkSellingPriceTagHaveDefault(Long prdInfoId);
}